package com.itheima;

import java.util.Random;
import java.util.Scanner;

public class Java_12 {
    public static void main(String[] args) {
    //案例：抢红包
        int[] arr = new int[]{11,22,33,44,55};
        start(arr);
    }
    public static void start(int[] moneys){
        Scanner sc = new Scanner(System.in);
        Random r = new Random();

            for (int i = 1; i <=5 ; i++) {
                System.out.print("请输入任意内容：");
                sc.next();
                while (true){
                    int index = r.nextInt(moneys.length);
                    int money = moneys[index];
                    if (money != 0){
                        System.out.println("恭喜你，抽到了"+ money+"元");
                        moneys[index] = 0;
                        break;
                    }
                }
            }
    }
}
